using System;

namespace CLELCore.Collections
{
	public class HeapItem
	{
		private byte [] _item;
		private bool _free;

		public byte[] Item
		{
			get
			{
				return _item;
			}
			set
			{
				_item = value;
			}
		}
		public bool Free
		{
			get
			{
				return _free;
			}
			set
			{
				_free = value;
			}
		}
		public int Size
		{
			get
			{
				if(_item != null)
					return _item.Length;
				return 0;
			}
		}
		public HeapItem(byte [] val)
		{
			if(val == null)
				throw new Exception("Byte array in HeapItem cannot be null");
			if(val.Length == 0)
				throw new Exception("Size of byte array must be greater than 0");
			_item = val;
			_free = false;
		}

		public HeapItem(int size)
		{
			if(size <= 0)
				throw new Exception("Size must be greater than 0");
			_item = new byte[size];
			_free = false;
		}
	}
}
